
//  DeleteExchangeDiscount.m
//  XJMCustomer
//  Created by 洗脚么_one on 2017/10/31.
//  Copyright © 2017年 Mr.hu. All rights reserved.

#import "DeleteExchangeDiscount.h"

@implementation DeleteExchangeDiscount

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self == [super initWithFrame:frame]) {
        
        CGFloat widthcancelbind = 270;
        CGFloat heightcancelbind = 246;
        
        UIView * subview = [[UIView alloc]initWithFrame:CGRectMake((ScreenWidth-widthcancelbind)/2, (ScreenHeight - heightcancelbind)/2, widthcancelbind, heightcancelbind)];
        subview.backgroundColor = [UIColor whiteColor];
        subview.layer.cornerRadius = 8;
        [self addSubview:subview];
        
        self.DeleteDiscountsConsiderBtn =[[UIButton alloc]init];
        self.DeleteDiscountsConsiderBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        self.DeleteDiscountsConsiderBtn.layer.cornerRadius = 15;
        self.DeleteDiscountsConsiderBtn.layer.masksToBounds = YES;
        [self.DeleteDiscountsConsiderBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.DeleteDiscountsConsiderBtn setBackgroundColor:RGBA(182, 182, 182, 1)];
        [subview addSubview:self.DeleteDiscountsConsiderBtn];
        [self.DeleteDiscountsConsiderBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(-30);
            make.left.mas_equalTo(28);
            make.size.mas_equalTo(CGSizeMake((widthcancelbind-71)/2, 35));
        }];
        
        self.DeleteDiscountsSureBtn =[[UIButton alloc]init];
        self.DeleteDiscountsSureBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        self.DeleteDiscountsSureBtn.layer.cornerRadius = 15;
        self.DeleteDiscountsSureBtn.layer.masksToBounds = YES;
        [self.DeleteDiscountsSureBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.DeleteDiscountsSureBtn setBackgroundColor:[UIColor colorWithRed:(213)/255.0 green:(32)/255.0 blue:(30)/255.0 alpha:(1)]];
        [subview addSubview:self.DeleteDiscountsSureBtn];
        [self.DeleteDiscountsSureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(-30);
            make.right.mas_equalTo(-28);
            make.size.mas_equalTo(CGSizeMake((widthcancelbind-71)/2, 35));
        }];
        
        self.leftDeleteToplab = [[UILabel alloc]init];
        self.leftDeleteToplab.textColor = [UIColor grayColor];
        self.leftDeleteToplab.font = [UIFont systemFontOfSize:14];
        self.leftDeleteToplab.textAlignment = NSTextAlignmentCenter;
        [subview addSubview:self.leftDeleteToplab];
        [self.leftDeleteToplab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.DeleteDiscountsSureBtn.mas_top).offset(-24);
            make.centerX.mas_equalTo(0);
            make.size.mas_equalTo(CGSizeMake(widthcancelbind,20));
        }];
        
        UIImageView * defaultimage = [[UIImageView alloc]init];
        [defaultimage setImage:[UIImage imageNamed:@"chahua"]];
        [subview addSubview:defaultimage];
        [defaultimage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.leftDeleteToplab.mas_top).offset(0);
            make.centerX.mas_equalTo(0);
            make.size.mas_equalTo(CGSizeMake(109.5,100));
        }];
        
        [self.DeleteDiscountsConsiderBtn addTarget:self action:@selector(cancelbindingOnclicked) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return self;
}

- (void)cancelbindingOnclicked{
    
    [self removeFromSuperview];
    
}

- (void)ViewDeleDiscountsSureBtn:(NSString *)deleDiscountsSureBtn DiscountsConsiderBtn:(NSString *)deleDiscountsConsiderBtn leftToplab:(NSString *)deleeftToplab;{
    
    [self.DeleteDiscountsConsiderBtn setTitle:deleDiscountsConsiderBtn forState:UIControlStateNormal];
    [self.DeleteDiscountsSureBtn setTitle:deleDiscountsSureBtn forState:UIControlStateNormal];
    self.leftDeleteToplab.text = deleeftToplab;
    
}
@end
